﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MainForm.aspx.cs" Inherits="JOIN.Rights.Web.Base.MainForm" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>苏州捷安信息科技有限公司-权限平台</title>
    <link href="~/Styles/Leftmenu.css" rel="stylesheet" type="text/css" />
    <link rel="STYLESHEET" type="text/css" href="../DHTMLX/tabControl/dhtmlxtabbar.css" />
    <link rel="STYLESHEET" type="text/css" href="../Styles/MainFrame.css" />
    <script  src="../DHTMLX/tabControl/dhtmlxcommon.js" type="text/javascript"></script>
    <script  src="../DHTMLX/tabControl/dhtmlxtabbar.js" type="text/javascript"></script>
   <%-- <script src="../DHTMLX/tabControl/dhtmlxcontainer.js" type="text/javascript"></script>--%>
    <script src="../Scripts/mainFrame.js" type="text/javascript"></script>
   <%-- <script  src="../Scripts/tabManage.js" type="text/javascript"></script>--%>
    
    
     <style type="text/css">
        /*
        *
        {
            margin: 0px;
            padding: 0px;
        }
        html, body
        {
            height: 100%;
            overflow: hidden;
        }
        body
        {
            border: 1px solid #ffffff;
        }
        .container
        {
            width: 100%;
            height: 100%;
        }
        .container .header
        {
            width: 100%;
            height: 50px;
            background-color: #00CCFF;
            background-image:url();
        }
        .container .footer
        {
            width: 100%;
            height: 20px;
            margin-bottom: 0px;
            position: absolute;
        }
        .container .mainContent
        {
            width: 100%;
        }
        .mainContent .menu
        {
            width: 167px;
            background-color: #ffffff;
            top: 50px;
        }
        .mainContent .split
        {
            width: 15px;
            background-color: #00FF33;
            position: absolute;
            left: 167px;
            top: 50px;
        }
        .mainContent .content
        {
            background-color: #ffffff;
            position: absolute;
            left: 182px;
            top: 50px;
        }
        */
    </style>
</head>
<body style="overflow: hidden; position: relative; height: 100%; margin: 0px; padding: 0px;
    border: medium none;">
    
    <form id="form1" runat="server">
    <ajaxToolkit:ToolkitScriptManager ID="scriptManager1" runat="server" >
         
    </ajaxToolkit:ToolkitScriptManager>
    
     <div id="container" class="container">
        <div id="header" class="header">
            <h2>苏州捷安权限管理平台</h2>
        </div>
        <div id="mainContent" class="mainContent">
            <div id="menu" class="menu" style="display: block;">
                <Kevin:LeftMenu ID="LeftMenu1" runat="server" Target="ifrContent" />
            </div>
            <div id="split" class="split" onclick="hide(this);">
                <iframe id="ifrSplit" name="ifrSplit"   scrolling="no" height="100%"
                    width="15px" marginwidth="0" marginheight="0" frameborder="0"></iframe>
            </div>
            <div id="content" class="content">
                <iframe id="ifrContent" name="ifrContent" src="Content.aspx" scrolling="no" height="100%"
                    width="100%" frameborder="0"></iframe>
            </div>
        </div>
        <div id="footer" class="footer">
        Copyright @JOIN
        </div>
    
    
    </div></form>
   <script type="text/javascript" language="javascript">

       $mainFrame.init();
       

   
    //----------------------------------------------------------------------
    //----------------------------------------------------------------------
    //$tabManage.init("tabContent");
    //此函数用于菜单导航
    function Goto(id,title,link){
        //$tabManage.newTab(id, title, link);
        //window.ifrContent.NewTabPage(id, title, link);
        window.ifrContent.$tabManage.newTab(id, title, link);

    } 
    /*
    //----------------------------------------------------------------------
    //此函数仅给出一个示例：您可以在javascript中通过如下的方法访问LeftMenu实例
    //并调用其中的方法
    function findMenu(id)
    {
        var menu=$find("LeftMenu1");
        menu.menuItemSetCurrentCSS(this,{"id":"menuItem_"+id,"from":""});
        
    }
    //----------------------------------------------------------------------
    //此函数用于菜单的显示与隐藏，并调整相关元素的位置、大小
	function hide(e){
	   var menu=document.getElementById("menu");
	   var displayValue = menu.style.display;
	   var split = document.getElementById("split");
	   var content = document.getElementById("content");
	   
	   if(displayValue=="block"){	
	       menu.style.display="none";
	       $common.setVisible($get("LeftMenu1"),false);
	       split.style.left ="0px";
	       content.style.left = "15px";
	       content.style.width = parseInt(content.style.width) + 160;
	       $get("ifrContent").style.width = content.style.width;
        }
        else{
	           menu.style.display="block";
	           $common.setVisible($get("LeftMenu1"),true);
	           split.style.left ="167px";
	           content.style.left = "182px";	
	           content.style.width = parseInt(content.style.width) - 160;
	           $get("ifrContent").style.width = content.style.width;
	           
	           windowAutosize();
	           
	           var leftMenu = $find("LeftMenu1");
	           
	           leftMenu._setSize();
        }
	
	}
	//----------------------------------------------------------------------
	//对于页面布局的初始化
	function init(){
	
		var header=document.getElementById("header");
		var footer=document.getElementById("footer");
		var mainContent = document.getElementById("mainContent");
		var menu=document.getElementById("menu");
		var split=document.getElementById("split");
		var content=document.getElementById("content");
		
		var height = document.body.clientHeight;
		var width = document.body.clientWidth;
		
		if(!bIsPad){
		    mainContent.style.height = height - header.clientHeight -  footer.clientHeight;
		}
		menu.style.height = split.style.height=content.style.height=mainContent.style.height;
		footer.top = header.clientHeight + mainContent.clientHeight;
		mainContent.style.width = width;
		content.style.width = width - menu.clientWidth - split.clientWidth;
		//$get("ifrContent").style.width = content.style.width;
		//$get("ifrContent").style.height = menu.style.height;
	}
	
	init();
	//----------------------------------------------------------------------
	function setMenuLocation()
    {
        var menuDiv= $get("LeftMenu1");
        
        if(menuDiv != null)
        {
            try{
                    var leftFrame = $get("leftFrame");
                    var bounds = new Sys.UI.Bounds(4 , 50, 167, 20);
                    $common.setLocation(menuDiv, bounds);
                    var clientBounds=$common.getClientBounds();
                    var newBounds=new Object();
                    var topSize=50;
                    newBounds.width=167;
                    newBounds.height=clientBounds.height-topSize-20;
                    
                    $common.setSize(menuDiv,newBounds);
                    
                   // $common.setLocation($get("btnFind"),bounds);
                    
                }
                catch(e)
                {
                    alert(e);
                }
        }
        //alert("processed");
    }
    //-----------------------------------------------------------------------
    setMenuLocation();
    //-----------------------------------------------------------------------
    //窗体内各相关功能区域的高度宽度自适应
   //*/
    
    function windowAutosize(){
        var windowWidth = document.body.offsetWidth;
        var windowHeight = document.body.offsetHeight;
        
        var containerDiv = $get("container");
        var headerDiv =$get("header");
        var menuDiv = $get("LeftMenu1");
        var splitDiv = $get("split");
        var mainContentDiv = $get("mainContent");
        var contentDiv = $get("content");
        var footerDiv = $get("footer");
        var ContentIFrame = $get("ifrContent");
        var menuVisible = $common.getVisible($get("LeftMenu1"));
        var containerSize = { width: windowWidth, height: windowHeight };
        $common.setSize(containerDiv, containerSize);
        
//        containerDiv.style.width = windowWidth;
//        containerDiv.style.height = windowHeight;
        var menuSize = { width: 167, height: Math.max(windowHeight - headerDiv.offsetHeight - footerDiv.offsetHeight, 50) };
        if(menuVisible){
            //menuDiv.style.height = Math.max(windowHeight - headerDiv.offsetHeight - footerDiv.offsetHeight, 50);
            
            $common.setSize(menuDiv, menuSize);
        }
        var mainContentSize = { width: windowWidth, height: windowHeight };
        $common.setSize(mainContentDiv, mainContentSize);
        //size = $common.getSize(contentDiv);
        //contentDiv.style.height = Math.max(windowHeight - headerDiv.offsetHeight - footerDiv.offsetHeight, 50);
        var splitSize = { width: 20, height: windowHeight - headerDiv.offsetHeight - footerDiv.offsetHeight };
        //splitDiv.style.height = Math.max(windowHeight - headerDiv.offsetHeight - footerDiv.offsetHeight, 50);
        $common.setSize(splitDiv, splitSize);
        footerDiv.style.top = contentDiv.offsetHeight + headerDiv.offsetHeight;
        //$common.setSize
        //contentDiv.style.width = windowWidth - menuDiv.offsetWidth - splitDiv.offsetWidth;
        var contentSize = { width: containerSize.width - menuSize.width - splitSize.width,
            height: Math.max(containerSize.height - headerDiv.offsetHeight - footerDiv.offsetHeight, 50)
        };
        $common.setSize(contentDiv, contentSize);
        //ContentIFrame.style.width = contentDiv.style.width;
        var holderSize = { width: windowWidth - menuDiv.offsetWidth - splitDiv.offsetWidth, 
                           height: Math.max(windowHeight - headerDiv.offsetHeight - footerDiv.offsetHeight, 50) };
        if (window.ifrContent.$tabManage) {
            window.ifrContent.$tabManage.holderResize(contentSize);
        }
    }
    var sUserAgent = navigator.userAgent.toLowerCase();
    var bIsAndroid = sUserAgent.match(/android/i)=="android";
    var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
    var bIsPad = bIsIpad || bIsAndroid;
    if(!bIsPad){
        $addHandler(window,"resize",Function.createDelegate(this,windowAutosize));
    }
    //-----------------------------------------------------------------------
    //*/
    </script>
</body>
</html>

<script >
    windowAutosize();
    $mainFrame.setMenuLocation();
</script>
